package cn.aicnn.chatssespringboot.dto;

import java.util.Objects;

public class OOMAnalysisResponseDTO {

    // CK度量
    private int wmc;
    private int dit;
    private int noc;
    private int cbo;
    private int rfc;
    private int lcom;

    // 用例图度量
    private int useCasePoints;
    private int actors;
    private int useCases;
    private double UAW;
    private double UUC;
    private double TCF;
    private double EF;

    // 默认构造方法
    public OOMAnalysisResponseDTO() {
    }

    // 全参数构造方法
    public OOMAnalysisResponseDTO(int wmc,int dit, int noc, int cbo, int rfc, int lcom, int useCasePoints,
                                  int actors, int useCases, double UAW, double UUC, double TCF, double EF) {
        this.wmc = wmc;
        this.dit = dit;
        this.noc = noc;
        this.cbo = cbo;
        this.rfc = rfc;
        this.lcom = lcom;
        this.useCasePoints = useCasePoints;
        this.actors = actors;
        this.useCases = useCases;
        this.UAW = UAW;
        this.UUC = UUC;
        this.TCF = TCF;
        this.EF = EF;
    }

    // Getter和Setter方法


    public int getWmc() {
        return wmc;
    }

    public void setWmc(int wmc) {
        this.wmc = wmc;
    }

    public int getDit() {
        return dit;
    }

    public void setDit(int dit) {
        this.dit = dit;
    }

    public int getNoc() {
        return noc;
    }

    public void setNoc(int noc) {
        this.noc = noc;
    }

    public int getCbo() {
        return cbo;
    }

    public void setCbo(int cbo) {
        this.cbo = cbo;
    }

    public int getRfc() {
        return rfc;
    }

    public void setRfc(int rfc) {
        this.rfc = rfc;
    }

    public int getLcom() {
        return lcom;
    }

    public void setLcom(int lcom) {
        this.lcom = lcom;
    }

    public int getUseCasePoints() {
        return useCasePoints;
    }

    public void setUseCasePoints(int useCasePoints) {
        this.useCasePoints = useCasePoints;
    }

    public int getActors() {
        return actors;
    }

    public void setActors(int actors) {
        this.actors = actors;
    }

    public int getUseCases() {
        return useCases;
    }

    public void setUseCases(int useCases) {
        this.useCases = useCases;
    }

    public double getUAW() {
        return UAW;
    }

    public void setUAW(double UAW) {
        this.UAW = UAW;
    }

    public double getUUC() {
        return UUC;
    }

    public void setUUC(double UUC) {
        this.UUC = UUC;
    }

    public double getTCF() {
        return TCF;
    }

    public void setTCF(double TCF) {
        this.TCF = TCF;
    }

    public double getEF() {
        return EF;
    }

    public void setEF(double EF) {
        this.EF = EF;
    }

    // equals和hashCode方法
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        OOMAnalysisResponseDTO that = (OOMAnalysisResponseDTO) o;
        return  wmc == that.wmc &&
                dit == that.dit &&
                noc == that.noc &&
                cbo == that.cbo &&
                rfc == that.rfc &&
                lcom == that.lcom &&
                useCasePoints == that.useCasePoints &&
                actors == that.actors &&
                useCases == that.useCases &&
                UAW == that.UAW &&
                UUC == that.UUC &&
                TCF == that.TCF &&
                EF == that.EF;
    }

    @Override
    public int hashCode() {
        return Objects.hash(wmc, dit, noc,
                cbo, rfc, lcom, useCasePoints, actors, useCases, UAW, UUC, TCF, EF);
    }

    // toString方法
    @Override
    public String toString() {
        return "OOMAnalysisResponseDTO{" +
                ", wmc=" + wmc +
                ", dit=" + dit +
                ", noc=" + noc +
                ", cbo=" + cbo +
                ", rfc=" + rfc +
                ", lcom=" + lcom +
                ", useCasePoints=" + useCasePoints +
                ", actors=" + actors +
                ", useCases=" + useCases +
                ", UAW=" + UAW +
                ", UUC=" + UUC +
                ", TCF=" + TCF +
                ", EF=" + EF +
                '}';
    }

    // 生成报告的方法
    public String toReportString() {
        return "=== CK度量 ===\n" +
                "加权方法数(WMC): " + wmc + "\n" +
                "继承树深度(DIT): " + dit + "\n" +
                "子类数(NOC): " + noc + "\n" +
                "类间耦合度(CBO): " + cbo + "\n" +
                "类的响应集合(RFC): " + rfc + "\n" +
                "方法内聚缺乏度(LCOM): " + lcom + "\n\n" +

                "=== 用例图度量 ===\n" +
                "用例点(UCP): " + useCasePoints + "\n" +
                "参与者数: " + actors + "\n" +
                "用例数: " + useCases + "\n" +
                "UAW:" + UAW + "\n" +
                "UUC:" + UUC + "\n" +
                "TCF:" + TCF + "\n" +
                "EF:" + EF + "\n";

    }
}